package cn.xi.excep;

import cn.xi.domain.GeneralResult;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Component
@ControllerAdvice
public class NoException {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public GeneralResult cuowu(){
        GeneralResult generalResult =new GeneralResult();
        generalResult.setMsg("错了");
        generalResult.setFlag(false);
        return generalResult;
    }
}
